package com.wf.course.web.controller.member;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.utils.page.PageBean;
import com.wf.course.model.member.MemberInvitation;
import com.wf.course.service.IMemberInvitationService;
import com.wf.course.web.Interceptor.LogInfo;

@Controller
@RequestMapping("MemberInvitation")
public class MemberInvitationController {
	
	@Autowired
	private IMemberInvitationService service;
	
	@LogInfo("邀请关系列表查询")
	@RequestMapping("MemberInvitationList")
	public String MemberInvitationList(
					@RequestParam(value="pageNo",required=false) Integer pageNo,
					@RequestParam(value="pageSize",required=false) Integer pageSize,
					@RequestParam(value="mainPhone",required=false) String mainPhone,
					@RequestParam(value="telephone",required=false) String telephone,
					@RequestParam(value="userName",required=false) String userName,
					Model model
			){
		Map<String, Object> map = new HashMap<>();
		map.put("mainPhone", mainPhone);
		map.put("telephone", telephone);
		map.put("userName", userName);
		PageBean<MemberInvitation> pageBean = new PageBean<MemberInvitation>(pageNo,pageSize,null,map);
		service.getMemberInvitationList(pageBean);
		
		pageBean.setUrl("MemberInvitation/MemberInvitationList");
		model.addAttribute("page",pageBean);
		return "member/MemberInvitationList";
	}
	
	@LogInfo("铜钱关系")
	@RequestMapping("coinlogs")
	public String coinlogs(
					@RequestParam(value="pageNo",required=false) Integer pageNo,
					@RequestParam(value="pageSize",required=false) Integer pageSize,
					@RequestParam(value="mainPhone",required=false) String mainPhone,
					@RequestParam(value="telephone",required=false) String telephone,
					@RequestParam(value="userName",required=false) String userName,
					Model model
			){
		Map<String, Object> map = new HashMap<>();
		map.put("mainPhone", mainPhone);
		map.put("telephone", telephone);
		map.put("userName", userName);
		PageBean<MemberInvitation> pageBean = new PageBean<MemberInvitation>(pageNo,pageSize,null,map);
		service.getMemberInvitationCoinlogList(pageBean);
		
		pageBean.setUrl("MemberInvitation/coinlogs");
		model.addAttribute("page",pageBean);
		return "member/MemberInvitationCoinlogList";
	}
	@LogInfo("优惠券关系")
	@RequestMapping("activity")
	public String activity(
					@RequestParam(value="pageNo",required=false) Integer pageNo,
					@RequestParam(value="pageSize",required=false) Integer pageSize,
					@RequestParam(value="mainPhone",required=false) String mainPhone,
					@RequestParam(value="telephone",required=false) String telephone,
					@RequestParam(value="userName",required=false) String userName,
					Model model
			){
		Map<String, Object> map = new HashMap<>();
		map.put("mainPhone", mainPhone);
		map.put("telephone", telephone);
		map.put("userName", userName);
		PageBean<MemberInvitation> pageBean = new PageBean<MemberInvitation>(pageNo,pageSize,null,map);
		service.getMemberInvitationActivityList(pageBean);
		
		pageBean.setUrl("MemberInvitation/activity");
		model.addAttribute("page",pageBean);
		return "member/MemberInvitationActivityList";
	}
}
